package com.example.test.advice.第三章_类_对象_方法.建议38_使用静态内部类提高封装性;

public class InnerClass {

    private void test(){
        System.out.println("===test===");
    }

    public static void main(String[] args) {
        //定义张三这个人
        Person p = new Person("张三");
        //设置张三的家庭信息
        p.setHome(new Person.Home("上海","023"));

        System.out.println(p);
    }

    class inner {

        private String name;

        public int age;

        public String getName() {
            test();
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }
    }
}
